"use strict";
//ts 函数 参数  返回值
//有返回值
function getFullName(firstName, lastName) {
    return firstName + lastName;
}
console.log(getFullName('lili', 'zhang'));
/**
 * role : 讲师：1  学生:2  学委:3
 *
*/
var Role;
(function (Role) {
    Role[Role["teacher"] = 1] = "teacher";
    Role[Role["student"] = 2] = "student";
    Role[Role["team"] = 3] = "team";
})(Role || (Role = {}));
//没有返回值  给默认值  可选参数
function registry(username, password, role = Role.student, sex) {
    //注册的功能
}
registry('zs', 10);
//剩余参数rest  一组数据的和
function sum(str, ...num) {
    let sum = num.reduce((pre, cur) => {
        return pre + cur;
    });
    return `${str}:${sum}`;
}
console.log(sum('总和', 1, 2, 3, 4));
console.log(sum('总和', 7, 6, 5, 4, 3, 2, 12));
//函数重载
// function getInfo(name:string):string;
// function getInfo(age:number):string;
// function getInfo(param:any):string{
//     if(typeof param === 'string'){
//         return `我叫${param}`
//     }else if(typeof param === "number"){
//         return `我${param}岁`
//     }else{
//         return '有误'
//     }
// }
// console.log(getInfo(78))
